﻿using System;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Graphics;
using Microsoft.Xna.Framework.Input;

namespace PyramidShadow
{
    class LevelObject 
    {
        //Texture rpresenting the object
        protected Texture2D texture;

        protected Level level;
        // Animation representing the enemy
        protected Animation objectAnimation;

        //is animated?
        protected bool animated;

        // The box of the object relative to the top left corner of thescreen
        protected Rectangle boundingBox;

        // The state of the object
        private bool active;
        public bool Active
        {
            get { return active; }
        }
        
        //if the object uses a still image as texture
        protected LevelObject(Texture2D texture, Vector2 startPosition, Level level)
        {
            this.level = level;
            this.texture = texture;
            boundingBox = new Rectangle((int)startPosition.X,(int)startPosition.Y,texture.Width,texture.Height);
            // NOT animated => texture => still image
            animated = false;
            active = true;
        }

        //If the Object is animated
        protected LevelObject(Animation animation, Vector2 position, Level level)
        {
            this.level = level;
            objectAnimation = animation;
            boundingBox = new Rectangle((int)position.X,(int)position.Y,animation.FrameWidth,animation.FrameHeight);
            animated = true;
            active = true;
        }

        public abstract void Update(GameTime gameTime, KeyboardState currentKeyboardState);

        public abstract void Draw(SpriteBatch spriteBatch);
    }
}
